﻿namespace UnityEditor
{
    using System;
    using UnityEngine;

    [CustomEditor(typeof(Animator))]
    internal class AnimatorInspector : Editor
    {
        private SerializedProperty m_AnimatePhysics;
        private SerializedProperty m_ApplyRootMotion;
        private SerializedProperty m_Avatar;
        private SerializedProperty m_Controller;
        private SerializedProperty m_CullingMode;

        private void OnEnable()
        {
            this.m_Controller = base.serializedObject.FindProperty("m_Controller");
            this.m_Avatar = base.serializedObject.FindProperty("m_Avatar");
            this.m_ApplyRootMotion = base.serializedObject.FindProperty("m_ApplyRootMotion");
            this.m_AnimatePhysics = base.serializedObject.FindProperty("m_AnimatePhysics");
            this.m_CullingMode = base.serializedObject.FindProperty("m_CullingMode");
        }

        public override void OnInspectorGUI()
        {
            Animator target = base.target as Animator;
            base.serializedObject.UpdateIfDirtyOrScript();
            EditorGUIUtility.LookLikeInspector();
            EditorGUILayout.PropertyField(this.m_Controller, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Avatar, new GUILayoutOption[0]);
            if (target.supportsOnAnimatorMove)
            {
                EditorGUILayout.LabelField("Apply Root Motion", "Handled by Script", new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.PropertyField(this.m_ApplyRootMotion, new GUILayoutOption[0]);
            }
            EditorGUILayout.PropertyField(this.m_AnimatePhysics, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_CullingMode, new GUILayoutOption[0]);
            base.serializedObject.ApplyModifiedProperties();
        }
    }
}

